﻿using System;
using System.Web.Mvc;
using System.ComponentModel.DataAnnotations;
using System.Collections.Generic;

namespace BudgetMealsModels.Entities
{
    public class Meal
    {
        [HiddenInput(DisplayValue = false)]
        public int MealID { get; set; }
        [HiddenInput(DisplayValue = false)]
        public int UserCreatedID { get; set; }
        [HiddenInput(DisplayValue = false)]
        public String UserCreated { get; set; }
        [Required]
        public string Name { get; set; }
        [Required]
        [InverseProperty("Appetizers")]
        public Recipe Appetizer { get; set; }
        [Required]
        [InverseProperty("MainCourses")]
        public Recipe MainCourse { get; set; }
        [Required]
        [InverseProperty("Desserts")]
        public Recipe Dessert { get; set; }
        [InverseProperty("Meals")]
        public User User { get; set; }
        [HiddenInput(DisplayValue = false)]
        public byte[] ImageData { get; set; }
        [HiddenInput(DisplayValue = false)]
        public string ImageMimeType { get; set; }
        [NotMapped]
        public double Cost { get { return Appetizer.Cost + MainCourse.Cost + Dessert.Cost; } }
    }
}
